package com.jye.cloud.user.mapper;

import com.jye.cloud.domain.Courses;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface CoursesMapper {

    Courses findCourseById(@Param("id") int id);

    List<Courses> findAllCourses(@Param("skip")int skip,@Param("limit")int limit);

    void addCourse(@Param("courses") Courses courses);

    void updateCourse(@Param("courses") Courses courses);


    List<Courses> findHotCourses(@Param("skip")int skip,@Param("limit")int limit);

    List<Integer> findMyCoursesByUId(@Param("uId")int uId, @Param("skip")int skip,@Param("limit") int limit);

    List<Integer> findTeacherCoursesByUId(@Param("uId")int uId);


    List<Integer> findCourseUserIdByCId(@Param("cId")int cId);

    int haveCourse(@Param("cId")int cId, @Param("uId")int uId);

    List<Courses> findNewestCourses (@Param("skip")int skip,@Param("limit")int limit);

    List<Courses> findCoursesByType(@Param("type")String type, @Param("skip")int skip,@Param("limit")int limit);

    void userBuyCourse(@Param("uId")int uId, @Param("cId")int cId);

    String findCourseNameById(@Param("id")int id);
}
